package com.meilai.project.mapper.system;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.meilai.project.entity.system.Accounting;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface AccountingMapper extends BaseMapper<Accounting> {

    @Update("update accounting set active=false where user_id=#{userId} and department_id=#{departmentId}")
    void setActiveFalse(@Param("userId")long userId,@Param("departmentId")long departmentId);

    @Select("select * from accounting where user_id=#{userId} and department_id=#{departmentId}")
    List<Accounting> selectByUserIdAndDepartmentId(@Param("userId")long userId, @Param("departmentId")long departmentId);
}
